home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-20
/
chart1.zip
/
CHART12.C
< prev
Wrap
C/C++ Source or Header
|
1991-03-12
|
3KB
|
101 lines
/*
* chart.c, Version 1.2
*
* This program builds a chart suitable for scanner frequency
* entries. The frequency is shown with an area for a short
* note about each frequency. Start with a frequency such as
* 144, 154, etc.
*
* ### This little program is for VHF and UHF
* @@@ It is not designed for less than 1 MHz
* !!! or higher than 999 MHz.
*
* ### Also, the program ALWAYS prints a full
* @@@ page. It may stop on a frequency greater
* !!! than the stop setting, given wierd numbers.
*
* The chart is output to the screen, printer, or file:
*
* chart 5 144 149 - Screen
* chart 12.5 144 149 twometer - File
* chart 25 144 149 prn - Printer
*
* Based on a program by Tony B. Anderson, Copyright (c) 1987
* All Rights Reserved
*
* Turbo-C Version written by Steve Sampson 75136,626
*
* 1.0 Converted Tony's BASIC and expanded a little.
* 1.1 Fixed the frequencies so they are right justified instead
* of left.
* 1.2 Made the frequency spacing programmable.
*/
#include <stdio.h>
#include <math.h>
static char top[] = " ________ ";
static char bot[] = "|________|";
static double s1, s2, s3;
void
main(argc, argv)
int argc;
register char *argv[];
{
register int i;
if (argc < 4 || argc > 5) {
fprintf(stderr, "Usage: chart 'kHz spacing' 'start freq' 'stop freq' [filename | PRN]\n");
exit(1);
}
s1 = atof(argv[1]) / 1000.0000;
s2 = atof(argv[2]);
s3 = atof(argv[3]);
if (s1 > .99990) {
fprintf(stderr, "Fatal - Spacing limits are 1 kHz to 999.9 kHz\n");
exit(1);
}
if ((s2 < 1.0) || (s3 > 999.0)) {
fprintf(stderr, "Fatal - Start/Stop limits are 1 MHz to 999 MHz\n");
exit(1);
}
if (s3 < s2) {
fprintf(stderr, "Fatal - Start frequency greater than Stop\n");
exit(1);
}
if (argc == 5) {
if (freopen(argv[4], "w", stdout) == NULL) {
fprintf(stderr, "Fatal - Unable to open output file\n");
exit(1);
}
}
do {
printf("\t\tS C A N N E R F R E Q U E N C Y C H A R T\n");
printf("\t\t---------------------------------------------\n\n");
printf("%s %s %s %s\n", top, top, top, top);
for (i = 0; i < 50; i++, s2 += s1)
printf("%8.4f %s %8.4f %s %8.4f %s %8.4f %s\n",
s2, bot,
s2 + (s1 * 50.0000), bot,
s2 + (s1 * 100.0000), bot,
s2 + (s1 * 150.0000), bot
);
putchar('\014'); /* form feed */
} while (((s2 += (s1 * 150.0000)) + s1) < s3);
exit(0);
}
/* EOF */